﻿package toolbar.font {
	import flash.text.*;
	import toolbar.NormalButton;
	import toolbar.icon.FontSizeIcon;
	
	public class FontSizeButton extends NormalButton {
		private var tf:TextField;
		private var format:TextFormat;
		
		public function FontSizeButton(name:String):void {
			super(name, 54);
			addIcon(new FontSizeIcon());
			tf = new TextField();
			tf.x = 4;
			tf.y = 3;
			tf.height = 16;
			tf.width = 32;
			tf.text = "12px";
			tf.selectable = false;
			format = tf.getTextFormat(0, 1);
			format.font = "宋体";
			format.size = 12;
			format.align = TextFormatAlign.CENTER;
			tf.setTextFormat(format, 0, tf.text.length);
			addChild(tf);
		}
		
		public function setDisplaySize(size:int):void {
			tf.text = size + "px";
			tf.setTextFormat(format, 0, tf.text.length);
		}
	}
}